#include <iostream>
#include <set>
using namespace std;

signed main()
{
    int n;
    cin>>n;
    set<int> ans;
    for(int i=0;i<n;i++){
        string s;
        cin>>s;
        int sum = 0;
        for(int j=0;j<s.size();j++)    sum += s[j]-'0';
        ans.insert(sum);
    }
    cout<<ans.size()<<"\n";
    int flag = 0;
    for(auto it:ans){
        if(flag)    cout<<" ";
        cout<<it;
        flag = 1;
    }
    return 0;
}
